// 统一的注册所有的全局组件
import { App, Component } from 'vue'
import XtxSkeleton from '@/components/skeleton/index.vue'
import XtxCarousel from "@/components/carousel/index.vue";
import XtxMore from "@/components/more/index.vue";
import XtxBread from '@/components/bread/index.vue'
import XtxBreadItem from '@/components/bread/item.vue'
import XtxCity from '@/components/city/index.vue'
import XtxNumBox from '@/components/numbox/index.vue'
import XtxButton from '@/components/button/index.vue'
import XtxCheckbox from '@/components/checkbox/index.vue'
import XtxMessage from '@/components/message/message.vue'
import XtxDialog from '@/components/dialog/index.vue'
import XtxSwitch from '@/components/switch/index.vue'
import XtxTabs from '@/components/tabs/index.vue'
import XtxTabsPane from '@/components/tabs/pane.vue'

const components: Record<string, Component> = {
  XtxSkeleton,
  XtxCarousel,
  XtxMore,
  XtxBread,
  XtxBreadItem,
  XtxCity,
  XtxNumBox,
  XtxButton,
  XtxCheckbox,
  XtxMessage,
  XtxDialog,
  XtxSwitch,
  XtxTabs,
  XtxTabsPane
}

export default {
  install (app: App) {
    // 遍历 components 对象的 key
    Object.keys(components).forEach((key) => {
      // 将每个组件注册到 app 中
      app.component(key, components[key]);
    });
  }
};
